const config = require('../config/auth.config.js')
const jwt = require('jsonwebtoken');
const auth = (ctx, next) => {
    // console.log('auth,66666')
    const authorization = ctx.header.authorization || '';
    // ctx.body = authorization
    // verify 验证
    const jsonObj = jwt.verify(authorization, config.secret)
    ctx.request.uid = jsonObj.uid;
    next()
}

module.exports = auth